#ifndef SERVER_H
#define SERVER_H
#include <string>
#include <boost/asio.hpp>
#include "io_thread_pool.h"
#include "tcp_connection.h"

using namespace boost::asio;
using namespace boost::asio::ip;

class TcpServer
{
public:
	TcpServer(const std::string& port, const std::string addr = "0.0.0.0");

	void Start();

private:
	void StartAccept();

	void OnConnection(const boost::system::error_code& err);

	void HandlStop(){};

private:
	IOThreadPool	io_pool_;
	tcp::acceptor	acceptor_;
	signal_set		signal_set_;
	int			current_index_;
	TcpConnectionPtr	new_connection_;
};

#endif


